package lif.controller;

import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;

import lif.beans.User;
import lif.service.MyService;

@SuppressWarnings("unused")
@Controller
//@RequestMapping
public class MyContrller
{
    @Autowired
    private MyService myservice;
    
    @RequestMapping("/login")
    public String login()
    {
        myservice.login();
        //        System.out.println("login");
        DispatcherServlet dis;
        return "bc";
    }
    
    @RequestMapping("/login0/{name}")
    public String login0(@PathVariable String name) throws Exception
    {
        myservice.login();
        System.out.println("login");
        System.out.println(name);
        return "index2";
    }
    
    @RequestMapping(value = "/login2", produces = {
            MediaType.APPLICATION_JSON_VALUE })
    public User login2()
    {
        myservice.login();
        //        System.out.println("login");
        User user = new User();
        return user;
    }
    
    @RequestMapping(name="/restlogin")
    @ResponseBody
    public User restlogin()
    {
        myservice.login();
        
        User user = new User();
        return user;
    }
}
